SCAR CDE Manual 1.10
Author information
SCAR is created by Kaitnieks (Aivars Irmejs)
(C) 2004 Aivars Irmejs
If you like SCAR, drop me a line:
aispam@serveris.lv
Community website: www.rscheatnet.com (I
am not responsible for contents of the site).
SCAR Scripts: www.scriptdump.net (I am
not responsible for contents of the site).
Introduction
There used to be a cheat for THE GAME which was able to do virtually every
boring action the players do every day over and over again. The name was
AutoRune. It worked on almost all Windows systems and introduced scriptable
cheats for the game, it could do anything except auto-PKing. The problem however
was, that THE COMPANY could easily make it cease to work by changing the game
communication protocol, which they did. Now the AutoRune and other bots, like
RS are useless and dead. AutoRune due to communication protocol change,
RS due to making the JAVA code undecompilable or at least much harder to
decompile. So people have to get their old clickers out of the shelves, clean
dust off them and cheat as much as they can, which is not very much, but at least
something.
My ultimate goal was to make the best clicker for the game, however I realized
fast, that there could be no "best" as some people prefer functionality but
others ease to use. So I decided to design a CDE for the game, something that
has never been tried before. CDE stands for cheat development environment. SCAR
stands for Shite Compared to AutoRune. It's not just a clicker, it's a
programmable clicker using Pascal language and I'm also planning to add
possibility to compile the scripts to exe files, so anyone with basic Pascal and
SCAR knowledge can create their own fully functional cheats. Do it while you
can, color macros is not the future of THE GAME, I have my own reasons to
believe in it, I will however keep them with myself.
I won't go deep into explanation of Pascal language, there are plenty tutorials
out there, use www.google.com but I will
demonstrate some basic control structures and compare some of them to AutoRune script.
Introduction II
Lots of time has passed since the very first SCAR version. It's been
improved a lot. I've been threatened by THE COMPANY because of it, it has caused
lots of frustration and confusion because of the complexity of it's usage and
surprisingly there are some people who have actually enjoyed it. There
have been some Anti-SCAR things added to The Game like Minimap, which changes
angle every time you look at it to disable map walking scripts and fatigue with
sleepwords.
The SCAR is used by about six hundreds of players daily when I write
these lines. There is SCAR forum, there are few script dumps. And sadly there
are scammers impersonating me. You must believe I will never distribute any
files by e-mail or likewise. We never implemented ability to compile scripts not because we
couldn't, but because Cow, former community leader, convinced me, that this
might get abused by scammers. It's a big problem. The Company should fight
scammers not cheaters.
So what's the future of SCAR? I'm not going to add anything new to it, I might
keep fixing bugs, but the further development is now in Dylock's hands. He's
working on SCAR that is compatible with version 2 of The Game.
General
You should start with trying out sample scripts. The shortcut keys
are Ctrl+Alt+R to run script and Ctrl+Alt+S to stop.
If it doesn't click for some reason or you are using SUN JAVA VM, turn off
silent mouse from Tools menu.
If it can't find the client window, select Specify Client title from Tools menu
and enter the title of the client you are using. Character case does matter. Or
just drag the crosshair over the client (the game area itself).
If it can't handle the map (map failed), make sure you have turned it correctly
(the north should be pointing perfectly up and the cross should be perfectly
straight). Most map walking scripts won't work because of the Anti-SCAR routines
mentioned above.
If it can't read texts or there are any other problems, make sure you have
extracted all required files and directories from the archive.
Pascal basics
Some Pascal basics can be found here, but I must warn you that the site will
scare you:
http://www2.iicm.edu/hmcard/courseware/pascal/Pascal2.htm
Or you could try this site:
http://web.mit.edu/taoyue/www/tutorials/pascal/contents.html
You really should find and read a serious Pascal tutorial, this manual will give you an
idea, not teach the Pascal language.
The simplest Pascal program:
begin
end.
As you see, it requires 2 lines - begin shows where the program starts, end with
dot - where it ends. Everything after it gets ignored. A better program would
be:
program MyFirst;
begin
Writeln ('Hello World!');
end.
It's a good style to specify program name at the beginning, also pay attention
to spacing, small and capital letters, usage of semicolons.
Here is a thing about variables. I know most of you avoided them at all in AR
script, but they are easier here (I hope). The variables have types. SCAR
supports less types than Pascal and for those who are familiar with Pascal - it
doesn't support arrays (ok it actually does, I just didn't want to explain it
here :P). Here are types you will use:
| string | Text, string of characters | 'a', 'some text', 'awaa'#13'bah' |
| Integer | Whole numbers, positive and negative | 0, 1, 2, 3, ..., -1, -2, -3, ... |
| Extended | Real numbers, positive and negative | 0, 1.5, -100.67, 100.3333 |
| Boolean | Have only 2 values - true or false | True, False |
There are other types too, but these are the main to operate with. A simple example:
program VarDemo;
var s: string;
begin
s:= 'Hello World!';
Writeln(s);
end.
As you see, we have to use var variable_name : type; to define the variable
before using it.
You will sometimes want to print out Integer and Extended type variable values,
so here is a sample to do it as only strings can be printed out. A sample of
type conversion:
program PrintNumbers;
var i: Integer;
e: Extended;
begin
i:= 10;
e:= 3.5;
Writeln('i=' + IntToStr(i) + ', e=' + FloatToStr(e));
end.
(Copy and paste it in SCAR window to test)
What can you do with variables? It depends on variable type. You can concatenate
string variables: s:= 'wo' + 'rd'; will result with 'word' in variable s. You
can do a whole bunch of arithmetic operations with Integer and Extended: i:= 4 +
5 will result with 9 in i etc. Boolean are useful too. You can set it to true or
false: b:= True; or to logical condition b:= (a = 1); will result with True in b
is a is equal to 1 or False if a is equal to anything else.
Now about control types. I will use AR script to compare.
Conditional statement.
if( a = 1)or(a = 4)then
begin
a:= 0;
Writeln('a was 1 or 4 so we made it to zero');
end else
begin
Writeln('a was neither 1 nor 4');
end;
This script checks if variable a is 1 or 4 and acts accordingly. Here is AutoRune equivalent for ARscripters:
GoToIfVarEqualNum(@Label1, %a, 1)
GoToIfVarEqualNum(@Label1, %a, 4)
Debug("a was neither 1 nor 4")
GoTo(@Label2)
Label1:
SetVarNum(%a, 0)
Debug("a was 1 or 4 so we made it to zero")
Label2:
Which one is easier?
While loops.
i:= 0;
while(i < 10) do
begin
i:= i + 1;
Writeln(IntToStr(i));
end;
AR script equivalent:
SetVarNum(%i, 0)
@LoopStart:
GoToIfVarAboveNum(@EndLoop, %i, 9)
AddVarNum(%i, 1)
DebugVar(%i)
GoTo(@LoopStart)
@EndLoop:
Repeat loop is very similar, except the condition is checked at the end of the loop and it's exit condition (if it's true, the loop ends), so it always go through repeat-until loop at least 1 time.
i:= 0;
repeat
i:= i + 1;
Writeln(IntToStr(i));
until(i >= 10);
AR script equivalent:
SetVarNum(%i, 0)
@LoopStart:
AddVarNum(%i, 1)
DebugVar(%i)
GoToIfVarBelowNum(@LoopStart, %i, 10)
For loops.
for i:= 1 to 10 do
begin
Writeln(i);
end;
In AR Script you would have to use while loop or repeat-until equivalent.
That's all about control structures. You will understand more from the examples
included with SCAR.
Creating map walking
Landmarks don't work with the regular RS client anymore
This section explains how to create map walking scripts. The
functions/procedures that you will have to use are: CreateLandmark, CreatePath,
AddLandmarkToPath, ProcessMap, ProcessPath.
How does it work? First thing to do is to create landmarks all along the path.
To do it, open the minimap (compass arrows have to make a perfect, straight
cross) and press "Create Landmark". If everything is correct, a copy of minimap
should appear with all objects, walls etc in it. Cut out the area you want to
create the landmark of. I prefer landmarks in width and height 25% of minimap's
width and height and smaller. Then press ok. It should generate CreateLandmark
command for you. Do it all along the path, make sure every next landmark is
perfectly visible from the previous one. They can't be too close. After you have
done that, you will have a list of them. Assign them to variables (like in
sample scripts).
Next thing you do is creating the path. Create new path with CreatePath like in
sample scripts.
Now you need to add the landmarks to the path. The sequence is important - the
destination landmark comes first, then the one right before it etc, the last one
is the place you start at. Let's say we have AddLandmarkToPath(BedPath,
LandMark4, 5, -4); What do the numbers mean? BedPath is path variable, LandMark4
is landmark variable, 5, -4 are coordinates - x, y. x, y represents relative
coordinates from the landmark that should be clicked to move along the path. In
this example SCAR will click 5 squares to right from the landmark's left side
and 4 squares above the landmark's upper edge.
Now that the paths are created, we need to move by them somehow. I propose to
use this procedure:
procedure GoByPath(path: Integer);
var
HowFar: Integer;
x, y: Integer;
r: Extended;
Dest: Boolean;
begin
repeat
MoveMouse(460,15);
Wait(200);
ProcessMap;
HowFar:= ProcessPath(Path, x, y, r, 0.1);
Status('HowFar='+IntToStr(HowFar)+' x='+IntToStr(x) + ' y='+IntToStr(y)+'
r='+FloatToStr(r));
if(r > 0.6)then
begin
if(HowFar = 0)then
ClickMap(x, y, True)
else
ClickMap(x + Random(3)-1, y +
Random(3) - 1, True);
end;
Dest:= (HowFar=0)and(x<=19)and(x>=17)and(y<=19)and(y>=17);
if(not Dest)then
Wait(5000);
until(Dest);
end;
If you want to know how ProcessPath works, keep reading. It has 5
parameters ProcessPath(Path, x, y, r, tolerance); Path is path variable, x, y
are variables where coordinates to be clicked are returned, r returns
possibility that we are still on the path (0..1), where 0 means that we are
totally lost (or map is closed or turned to wrong angle) and 1 means it's a
perfect match. tolerance contains allowed error. Like, if you are near landmark
l2 and you see landmark l1 which is your destination, it will go to l1 whenever
match of that landmark + tolerance => match of the current landmark. I suggest
to use 0.1 or 0.2 as tolerance. If you are required to use bigger then your
landmarks are somehow bad.
Using forms.
To use forms you got to understand how objects work. First of all, what is a
class? Class is basically a definition of object with it's properties and
methods, it's like a blueprint. When we create object from class, we have
something to actually work with. So we have to create everything - forms,
textboxes, buttons, checkboxes etc. After you have finished using the object,
free it.
Here is a sample form:
program FormTest;
var
form, self: TForm;
Application: TApplication;
UserLabel, PassLabel: TLabel;
txtUser, txtPass: TEdit;
ButtonOK: TButton;
//Event handler for ButtonOk.OnClick
procedure buttonclick(sender: TObject);
begin
Application.MessageBox('You pressed the button!', 'Button Pressed', 0);
end;
begin
//Initialize Application object
Application:= GetApplication;
Self:= GetSelf;
//////////////////////////////////////
// Creating and using forms
//////////////////////////////////////
//Create form for login/password
Form:= TForm.Create(nil);
Form.Width := 220;
Form.Height := 140;
Form.Position := poScreenCenter;
Form.BorderStyle := bsDialog;
Form.Caption := 'Hello There';
//Create things on form
UserLabel := TLabel.Create(Form);
UserLabel.Top := 12;
UserLabel.Left := 16;
UserLabel.Caption := 'Username:';
UserLabel.Parent := Form;
PassLabel := TLabel.Create(Form);
PassLabel.Top := 42;
PassLabel.Left := 16;
PassLabel.Caption := 'Password:';
PassLabel.Parent := Form;
txtUser := TEdit.Create(Form);
txtUser.Top := 10;
txtUser.Left := 86;
txtUser.Width := 100;
txtUser.Parent := Form;
txtPass := TEdit.Create(Form);
txtPass.Top := 40;
txtPass.Left := 86;
txtPass.Width := 100;
txtPass.PasswordChar:= '*';
txtPass.Parent := Form;
ButtonOK := TButton.Create(Form);
ButtonOK.Left := 60;
ButtonOK.Top := 80;
ButtonOK.Width := 80;
ButtonOK.Height := 24;
ButtonOK.Caption := '&OK';
//Assign event to button that will hide form
ButtonOK.OnClick := @buttonclick;
ButtonOK.Parent := Form;
ButtonOK.Default := True;
ButtonOK.ModalResult:= mrOk;
//Show modal form
Form.ShowModal;
Form.Free;
end.
Let's look at bits of the code.
Application:= GetApplication; - get reference
to SCAR application.
Self:= GetSelf; - get reference to main form of SCAR.
Form:= TForm.Create(nil); - create a new form.
after form is created, we can set various properties of it, like:
Form.Height := 140;
To create controls on form, create a new object like this:
UserLabel := TLabel.Create(Form);
And then specify the new form as parent of the just created control:
UserLabel.Parent := Form;
You can assign events to controls like this:
ButtonOK.OnClick := @buttonclick;
That means every time button is clicked, procedure buttonclick will be
called.
Here is how you define the event handler procedure for onClick.
procedure buttonclick(sender: TObject);
begin
... code here
end;
Form.ShowModal; - form will be shown and script will wait until it's
closed.
Form.Free; - form is destroyed to free the memory. All controls on form
are destroyed as well.
Standard functions.
This is a list to functions you can use which do not requite THE CLIENT window.
The most useful (for you) functions are underlined.
procedure Writeln(s: string); - outputs string to debug box
procedure Status(s: string); - shows a message in status bar
function Readln(question: string): string; - asks question to user and
returns the answer
procedure Wait(ms: Integer); - Waits ms milliseconds (Wait(1000) - wait 1
second). You should use this to avoid freezing.
function inttostr(i: Longint): string; - converts integer to string.
function strtoint(s: string): Longint; - converts string to integer.
function strtointdef(s: string; def: Longint): Longint;
function copy(s: string; ifrom, icount: Longint): string; - returns part
of the string (Copy('abcde',2,3) would return 'bcd'.
function pos(substr, s: string): Longint; - returns position of substring in
string. Returns 0 if not found.
procedure delete(var s: string; ifrom, icount: Longint): string; - delete
part of string
procedure insert(s: string; var s2: string; ipos: Longint): string; - insert
s into s2.
function getarraylength: integer;
procedure setarraylength;
Function StrGet(var S : String; I : Integer) : Char;
procedure StrSet(c : Char; I : Integer; var s : String);
Function Uppercase(s : string) : string;
Function Lowercase(s : string) : string;
Function Trim(s : string) : string;
Function Length(s : String) : Longint;
procedure SetLength(var S: String; L: Longint);
function Random(Range: Integer): Integer;
Function Sin(e : Extended) : Extended;
Function Cos(e : Extended) : Extended;
Function Sqrt(e : Extended) : Extended;
Function Round(e : Extended) : Longint;
Function Trunc(e : Extended) : Longint;
Function Int(e : Extended) : Longint;
Function Pi : Extended;
Function Abs(e : Extended) : Extended;
function StrToFloat(s: string): Extended;
Function FloatToStr(e : Extended) : String;
Function Padl(s : string;I : longInt) : string;
Function Padr(s : string;I : longInt) : string;
Function Padz(s : string;I : longInt) : string;
Function Replicate(c : char;I : longInt) : string;
Function StringOfChar(c : char;I : longInt) : string;
function VarGetType(x: Variant): TVarType;
function Null: Variant;
procedure RaiseLastException;
procedure RaiseException(Ex: TIFException; Param: string);
function ExceptionType: TIFException;
function ExceptionParam: string;
function ExceptionProc: Cardinal;
function ExceptionPos: Cardinal;
function ExceptionToString(er: TIFException; Param: string): string;
Function means that the function returns a value, procedure just does something
and doesn't return anything. Parameters and their types are specified in
brackets and as the last comes type of function return value.
Supported classes
This is only a list of some of classes that can be used in SCAR. For more help on properties and methods of individual classes consult Delphi help or internet search. Remember that only very limited functionality is implemented and many properties and methods that work in Delphi will not work in SCAR. Not all supported classes are listed here, only the main ones.
TGroupBox - The TGroupBox component represents a standard group box, used to group related controls on a form.
TLabel - Use TLabel to add text or a bitmap that the user can’t edit to a form.
TEdit - Use a TEdit object to put a standard edit control on a form.
TMemo - Use TMemo to put a standard multiline edit control on a form.
TComboBox - A TComboBox component is an edit box with a scrollable drop-down list attached to it.
TButton - Use TButton to put a standard push button on a form.
TCheckBox - A TCheckBox component presents an option for the user.
TRadioButton - Use TRadioButton to add a radio button to a form.
TListBox - Use TListBox to display a scrollable list of items that users can select, add, or delete.
TScrollBar - Use TScrollBar to add a free-standing scroll bar to a form.
TImage - Use TImage to display a graphical image on a form.
TPanel - Use TPanel to put an empty panel on a form.
TTimer - TTimer is used to simplify calling the system timer functions.
TForm - form (window) component.
TApplication - TApplication encapsulates a windowed application.
TMenuItem - Use TMenuItem to specify the appearance and behavior of an item in a menu.
TMenu - Use TMenu as a base class when defining a component that represents a collection of menu items.
TMainMenu - Use TMainMenu to provide the main menu for a form.
TPopupMenu - Use TPopupMenu to define the pop-up menu that appears when the user clicks on a control with the right mouse button.
TCanvas - Use TCanvas as a drawing surface for objects that draw an image of themselves.
Client related functions
function GetUpperMsg: string; - alias for GetTextAt(6,2)
function GetTextAt(x, y: Integer): string; - get text at the specified coordinates.
function IsTextAt(x, y: Integer; S: String): Boolean; - works fater than GetTextAt - compares if there is specified text at x,y.
function IsTextInArea(x1, y1, x2, y2: Integer; var x, y: Integer; S: String): Boolean; - searches for text in S in box specified by x1, y1, x2, y2. Returns coordinates of the text in x, y if found.
procedure GetMousePos(var x,y: integer); - read current mouse position into x,y.
procedure MoveMouse(x,y: integer); - simulate mouse movement, move cursor to x,y.
procedure ClickMouse(x,y: integer; Left: boolean); - simulate mouse click at x,y.
procedure SetMouseMode(Silent: boolean); - if SetMouseMode(True) then it will move and click without moving mouse cursor. If that doesn't work, use SetMouseMode(False);
function Random(Range: Integer): Integer; - returns random 0 <= number < Range
function GetColor(x,y: Integer): Integer; - Return color number at x,y.
function GetFightMode: Integer; - Will return 0 is fight mode selection is invisible, 1 for controlled, 2 for str, 3 for att and 4 for def.
function FindColor(var x,y: Integer; color, xs, ys, xe, ye: Integer): Boolean; - find color in box specified by xs, ys, xe, ye starting from left to right. Returns True if color found, the coordinates of the color if found is put in x,y.
function FindColorSpiral(var x,y: Integer; color, xs, ys, xe, ye: Integer): Boolean; - find color in box specified by xs, ys, xe, ye but start from x,y.
function FindColorSpiral2(var x,y: Integer; color, xs, ys, xe, ye: Integer): Boolean; - find color just like FindColorSpiral, and if there is a big spot of that color then it finds the center of it.
function SpiralFindObj(var x,y: Integer; color, xs, ys, xe, ye: Integer; Step: Integer; Text: string; WaitTime, MaxTime: Integer): Boolean; - universal function for object finding. x, y contain coordinates to start search from and return coordinates of spot if object found, color - object color or -1 if the color is ignored, xs, ys, xe, ye specify box to search in (set them to -1 to search the whole client screen), Step - how many pixels skip (as more as faster), text - text to look for that appears when mouse is over the object at 6,2, WaitTime - time in milliseconds to wait before reading the text after moving the mouse, MaxTime - maximum time to search (if not found during tha time, give up)
function SpiralFindObjs(var x,y: Integer; color, xs, ys, xe, ye: Integer; Step: Integer; CommaText: string; WaitTime, MaxTime: Integer): Boolean; - works like SpiralFindObj but looks for multiple objects. CommaText is objects to look for, seperated by commas. If object name contains comma, put it in quotes like this Text = 'Object1,Object2,"Object,contains comma","Contains ""quotes"" and, comma",Object999';
procedure Wait(ms: Integer); -see above
procedure Sleep(ms: Integer); -alias of Wait
function SetTimeout(secs: Integer; procname: string): Integer; - set timed procedure. After secs seconds a procedure with name procname will be called. The procedure has no parameters and it's only called once (you can SetTimeout again in the procedure). Procedure must be declared as external.
procedure SendKeys(S: String); - simulate key pressing to send a string to the active window.
procedure SendKeysSilent(S: String); - send string to Client's window, if this doesn;t work, use SendKeys
function StartScreen: Boolean; - depreciated, only left for compatibility
function LoginScreen: Boolean; - depreciated, only left for compatibility
procedure FindRSWindow; - finds Client window (you can use it in cases if it's not found before)
function CreateLandmark(W, H: Integer; Data: string): Integer; - creates landmark. Use Script > Create landmark from main menu to generate a correct landmark
function FindLandmark(LandMark: Integer; var x,y: Integer; var accuracy: Extended): Boolean; - searches for the landmark in map (Get map into memory with ProcessMap first). x and y returns top left corner of the landmark in map, r contains 1 if the place in map matches the landmark perfectly and 0 if it's totally different.
procedure ProcessMap; - Analyzes image on client and creates map in memory.
procedure ProcessMapNoCompass; - reads the map into memory. Processing does not fail if compass is not perfectly straight.
procedure ClickMap(x,y: integer; Left: boolean); - click map coordinates. 18,18 are your coordinates.
function CreatePath: Integer; - Create new path
procedure AddLandmarkToPath(path, landmark, x, y: Integer); - add landmark to path, x,y contain relative coordinates from the top left corner of the landmark that should be clicked.
function ProcessPath(path: Integer;var x, y: Integer; var accuracy: Extended; Tolerance: Extended): Integer; - moves further by the path. Returns x, y - map coordinates that should be clicked, accuracy that we're on the path 0..1 and function value is number of the current landmark in the path.
function LoadBitmap(path: string): Integer; - Loads bitmap (*.bmp) in memory and returns handle to it. Path can be absolute or relative if starts with a dot.
function BitmapFromString(Width, Height: Integer; data: string): Integer; - Loads bitmap in memory from string data and returns handle to it. Data strings can be created by clicking menu Script > Picture To String.
function FindBitmap(bitmap: Integer; var x, y: Integer): Boolean; - search for the bitmap in client window. If found coordinates are returned in x,y. bitmap contains handle to bitmap generated by LoadBitmap.
function FindBitmapIn(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean; - search for the bitmap in coordinates specified by x1, y1, x2, y2.
function FindBitmapSpiral(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean; - search for the bitmap in coordinates specified by x1, y1, x2, y2 starting from x, y.
procedure PlaySound(FileName: string); - play the specified WAV file.
procedure SaveScreenshot(FileName: string); - save screenshot of client window in bitmap file.
procedure FindWindow(Title: string); - find client, look for window with title in titlebar.
procedure ActivateClient(Title: string); - activate client window.
function AppPath : string;- get SCAR folder path.
function GetSelf : TForm;- get reference to SCAR main form.
function GetApplication : TApplication;- get reference to SCAR Application object.
function GetCanvas : TCanvas;- get reference to game client window's Canvas.
procedure CopyCanvas(Source, Dest: TCanvas; sxs, sys, sxe, sye, dxs, dys, dxe, dye: Integer); - Copy area from Source canvas to Dest canvas. Area to be copied from is specified by sxs, sys, sxe, sye, area to be copied to is specified by dxs, dys, dxe, dye.
function GetCanvas(bitmap: Integer) : TCanvas;- get reference to bitmap's Canvas.